﻿using mscook.core.domain;
using mscook.core.repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mscook.core.services
{
    public class MaterialService : IMaterialService
    {
        private IMaterialRepository iMaterialRepository;
        public MaterialService(IMaterialRepository iMaterialRepository)
        {
            this.iMaterialRepository = iMaterialRepository;
        }
        public void SaveOrUpdate(Material Material)
        {
            iMaterialRepository.SaveOrUpdate(Material);
        }

        public Material Get(string id)
        {
            return iMaterialRepository.Get(id);
        }
        public IList<Material> SelectPageList(int start, int limit, out long total)
        {
            return iMaterialRepository.SelectPageList(start, limit, out total);
        }

        public bool Delete(string id)
        {
            return iMaterialRepository.Delete(id);
        }

        public IList<Material> SelectListShowOnHome()
        {
            return iMaterialRepository.GetAll();
        }

        public IList<Material> SelectLimitbyIds(IList<string> resourceIds, int start, int limit, out long total)
        {
            return iMaterialRepository.GetLimitByIds(resourceIds, start, limit, out total);
        }

        public IList<Material> GetByKeyword(string keyword, int start, int limit, out long total)
        {
            return iMaterialRepository.GetByKeyword(keyword,start,limit,out total);
        }

        public IList<Material> SelectPageListByExpressions(int start, int limit, out long total, System.Linq.Expressions.Expression<Func<Material, bool>> expression)
        {
            return iMaterialRepository.SelectPageList(start, limit, out total, expression);
        }
    }

   
}
